import java.util.*;
public class SortEnglish {
    public static void main(String args[]) {
        TreeSet<Score> mytree = new TreeSet<>();
        List<Score> mylist = new LinkedList<Score>();
        mylist.add(new Score("赵一", 89));
        mylist.add(new Score("钱二", 99));
        mylist.add(new Score("孙三", 100));
        mylist.add(new Score("李四", 92));
        mylist.add(new Score("周五", 88));
        //添加节点
        Iterator<Score> score = mylist.iterator();
        System.out.println("排序之前的：");
        while (score.hasNext()) {
            Score sco = score.next();
            mytree.add(sco);
            System.out.println(sco.name + " " + sco.english);
        }
        //将链表中的成绩放入树集中
        System.out.println("排序之后的：");
        Iterator<Score> te = mytree.iterator();
        while (te.hasNext()) {
            Score stu = te.next();
            System.out.println("" + stu.name + " " + stu.english);
        }
    }
}

    class Score implements Comparable {
        int english = 0;
        String name = "";

        Score(String name, int english) {
            this.name = name;
            this.english = english;
        }

        @Override
        public int compareTo(Object a) {
            Score b = (Score) a;
            return this.english - b.english;
        }
    }
